
		function queryString(str){
			var sValue=location.search.match(new RegExp("[\?\&]"+str+"=([^\&]*)(\&?)","i"));
			return sValue?sValue[1]:sValue;
		}

var name = queryString('name');
var num = queryString('num');

console.log(name+'|'+num);


//var servePath = "";
/*var servePath = "public/";
var basePath = servePath+"img/";*/
var basePath = "../img/mobile/";
var loader = new WxMoment.Loader();
var fileList = ["p1/1.jpg","p1/2.jpg","p1/3.jpg","p1/4.jpg","p1/5.jpg","p1/6.jpg","p1/7.jpg","p1/8.jpg","p1/9.jpg","p1/10.jpg","p1/11.jpg","p1/12.jpg","bgm.mp3","chen.png","david.png","jia.png","tanneberger.png","vollmer.png","xu.png","zhang1.png","zhang2.png","zhang3.png"];
for (var i = 0; i < fileList.length; i++) {
    loader.addImage(basePath + fileList[i]);
}
for (var i = 1; i <= num; i++) {
    //console.log(basePath + name +'/'+i+'.png');
    loader.addImage(basePath + name +'/'+i+'.png');
}
loader.addProgressListener(function (e) {
    var percent = Math.round((e.completedCount / e.totalCount) * 100);
    $("#loadingbg").show();
    $('#loadingtxt').html(percent + '%');
});
loader.addCompletionListener(function () {
    $("#loadingbg").hide();
    $("#content").show();
    indexbg();
    $('#qianming').attr('src','../img/mobile/'+name+'/1.png').addClass(name);
    $('#nametitle').addClass(name);
});
loader.start();


window.onresize = function(){
    windowWH();
};
//windowWH
function windowWH(){
    var ww = $(window).width();
    var wh =  $(window).height();
    var bghei = 1138;
    var autohei = 838;
    var ftop = (wh - autohei)/2;
    var bgauto1 = -(bghei-wh)/2;
    var bgauto2 = -(bghei-autohei)/2;

    if(ww < wh && wh >= autohei){
        //$(".bgimg").css("top",bgauto1);
        //$(".fix-height").css("top",ftop);
        $("#p1,#p2,#p3,body,html").css("height",wh);
        $(".swiper-container").css({height:(wh+1)+"px"});
    }else if(ww < wh && wh < autohei){
        //$(".bgimg").css("top",bgauto2);
        //$(".fix-height").css("top",0);
        $("#content").css({height:autohei+"px"});
        $(".swiper-container").css({height:autohei+"px"});  
    }


}

//popShow
function popShow(){
    $(".pop_one").hide();
    $("#bggray").show();
    $("#pop_window").show();
    $(".onoff").hide();
}
//popHide
function popHide(){
    $(".pop_one").hide();
    $("#bggray").hide();
    $("#pop_window").hide();
    $(".onoff").show();
}
//popDivs







//popOrientLayer
function popOrientLayer(){
    $("#orientLayer-bg").show();
    $(".pop-orientLayer").show();

}
function popOrientLayerHide(){
    $("#orientLayer-bg").hide();
    $(".pop-orientLayer").hide();
    //window.location.reload(true);
}




///////////////////////////////
$(function(){
    windowWH();
    orientationTips(); 
    //playAudio();

    var handler1 = function () {
        TweenLite.to($("#p2bg"), 2, {x: -385, onComplete: handler2});
    };
    var handler2 = function () {
        TweenLite.to($("#heci"), 1, {opacity: 1, delay: .5, onComplete: handler3});
    };// 
    var handler3 = function () {
        var qm = $('#qianming');
        qm.gifOn('../img/mobile/'+name+'/',num,{mode:2, speed:'40',repeat:0, onComplete: function(){
            $('#nametitle').attr('src', '../img/mobile/'+name+'.png').fadeIn('1000');
            setTimeout(function(){
                $('#p2').fadeOut();
                $('#p3').fadeIn();
            }, 2000);
        }});
        setTimeout(function(){
            reset();
        }, 6000);
    };// 
    




    $('.clickarea').on('click', function(){
        $('.clickarea, .tap').hide();
        $('#p1').fadeOut(2000);
        setTimeout(function(){
            TweenLite.to($("#p2bg"), 2, {scale: 1, onComplete: handler1, transformOrigin:'199px 708px'});
        }, 1600);
    })


});


function reset(){
    $('.clickarea, .tap').show();
    TweenLite.to($("#p2bg"), 0.01, {scale: 1.6, x:0, transformOrigin:'199px 708px'});
    TweenLite.to($("#heci"), 0.01, {opacity: 0});
    $("#p2bg").show();
    $('#qianming').attr('src', '../img/mobile/'+name+'/1.png');
    $('#nametitle').attr('src', '../img/mobile/'+name+'.png').hide();

    setTimeout(function(){
                    $('#p3').fadeOut(30);
                    $('#p1,#p2').fadeIn(30);
    }, 2000);
}


function  indexbg() {

    var p1bg = $('#p1bg');
    p1bg.gifOn('../img/mobile/p1/',12,{mode:2,type:'jpg', speed:'500',repeat:-1, onComplete: function(){
    }});

}


function infiniteAnimation() {



    

}





//orientationTips
function orientationTips(){
    if (window.orientation === 90 || window.orientation === -90 ){ 
        popOrientLayer();
    }  
    window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
        if (window.orientation === 180 || window.orientation === 0) { 
            popOrientLayerHide();
        } 
        if (window.orientation === 90 || window.orientation === -90 ){ 
            popOrientLayer();
        }  
    }, false);
}


